.class public Lcom/zuiapps/suite/utils/hud/ProgressHUD;
.super Landroid/app/Dialog;
.source "ProgressHUD.java"


# instance fields
.field private R:Lcom/zuiapps/suite/utils/ui/ResUtil;

.field private drawableId:I

.field private imageView:Landroid/widget/ImageView;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 22
    invoke-direct {p0, p1}, Landroid/app/Dialog;-><init>(Landroid/content/Context;)V

    .line 23
    invoke-static {p1}, Lcom/zuiapps/suite/utils/ui/ResUtil;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/ui/ResUtil;

    move-result-object v0

    iput-object v0, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    .line 24
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;I)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "theme"    # I

    .prologue
    .line 27
    invoke-direct {p0, p1, p2}, Landroid/app/Dialog;-><init>(Landroid/content/Context;I)V

    .line 28
    invoke-static {p1}, Lcom/zuiapps/suite/utils/ui/ResUtil;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/ui/ResUtil;

    move-result-object v0

    iput-object v0, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    .line 29
    return-void
.end method

.method public static safeDismiss(Landroid/app/Dialog;)V
    .registers 2
    .param p0, "dialog"    # Landroid/app/Dialog;

    .prologue
    .line 73
    if-eqz p0, :cond_5

    .line 75
    :try_start_2
    invoke-virtual {p0}, Landroid/app/Dialog;->dismiss()V
    :try_end_5
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_5} :catch_6

    .line 80
    :cond_5
    :goto_5
    return-void

    .line 76
    :catch_6
    move-exception v0

    .line 77
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_5
.end method

.method public static show(Landroid/content/Context;Ljava/lang/CharSequence;IZLandroid/content/DialogInterface$OnCancelListener;)Lcom/zuiapps/suite/utils/hud/ProgressHUD;
    .registers 12
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "message"    # Ljava/lang/CharSequence;
    .param p2, "drawableId"    # I
    .param p3, "cancelable"    # Z
    .param p4, "cancelListener"    # Landroid/content/DialogInterface$OnCancelListener;

    .prologue
    .line 83
    invoke-static {p0}, Lcom/zuiapps/suite/utils/ui/ResUtil;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/ui/ResUtil;

    move-result-object v0

    .line 85
    .local v0, "R":Lcom/zuiapps/suite/utils/ui/ResUtil;
    new-instance v1, Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    const-string v5, "ProgressHUD"

    invoke-virtual {v0, v5}, Lcom/zuiapps/suite/utils/ui/ResUtil;->styleId(Ljava/lang/String;)I

    move-result v5

    invoke-direct {v1, p0, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;-><init>(Landroid/content/Context;I)V

    .line 86
    .local v1, "dialog":Lcom/zuiapps/suite/utils/hud/ProgressHUD;
    iput p2, v1, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->drawableId:I

    .line 88
    const-string v5, ""

    invoke-virtual {v1, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setTitle(Ljava/lang/CharSequence;)V

    .line 89
    const-string v5, "progress_hud"

    invoke-virtual {v0, v5}, Lcom/zuiapps/suite/utils/ui/ResUtil;->layoutId(Ljava/lang/String;)I

    move-result v5

    invoke-virtual {v1, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setContentView(I)V

    .line 90
    if-eqz p1, :cond_27

    invoke-interface {p1}, Ljava/lang/CharSequence;->length()I

    move-result v5

    if-nez v5, :cond_6e

    .line 91
    :cond_27
    const-string v5, "text_message"

    invoke-virtual {v0, v5}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v5

    invoke-virtual {v1, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->findViewById(I)Landroid/view/View;

    move-result-object v5

    const/16 v6, 0x8

    invoke-virtual {v5, v6}, Landroid/view/View;->setVisibility(I)V

    .line 96
    :goto_36
    const-string v5, "image_spinner"

    invoke-virtual {v0, v5}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v5

    invoke-virtual {v1, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    .line 97
    .local v2, "imageView":Landroid/widget/ImageView;
    iput-object v2, v1, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    .line 99
    invoke-virtual {v1, p3}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setCancelable(Z)V

    .line 100
    invoke-virtual {v1, p4}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->setOnCancelListener(Landroid/content/DialogInterface$OnCancelListener;)V

    .line 101
    invoke-virtual {v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->getWindow()Landroid/view/Window;

    move-result-object v5

    invoke-virtual {v5}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams;

    move-result-object v5

    const/16 v6, 0x11

    iput v6, v5, Landroid/view/WindowManager$LayoutParams;->gravity:I

    .line 102
    invoke-virtual {v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->getWindow()Landroid/view/Window;

    move-result-object v5

    invoke-virtual {v5}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams;

    move-result-object v3

    .line 103
    .local v3, "lp":Landroid/view/WindowManager$LayoutParams;
    const v5, 0x3e4ccccd

    iput v5, v3, Landroid/view/WindowManager$LayoutParams;->dimAmount:F

    .line 104
    invoke-virtual {v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->getWindow()Landroid/view/Window;

    move-result-object v5

    invoke-virtual {v5, v3}, Landroid/view/Window;->setAttributes(Landroid/view/WindowManager$LayoutParams;)V

    .line 106
    invoke-virtual {v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->show()V

    .line 107
    return-object v1

    .line 93
    .end local v2    # "imageView":Landroid/widget/ImageView;
    .end local v3    # "lp":Landroid/view/WindowManager$LayoutParams;
    :cond_6e
    const-string v5, "text_message"

    invoke-virtual {v0, v5}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v5

    invoke-virtual {v1, v5}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    .line 94
    .local v4, "txt":Landroid/widget/TextView;
    invoke-virtual {v4, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_36
.end method


# virtual methods
.method public onWindowFocusChanged(Z)V
    .registers 6
    .param p1, "hasFocus"    # Z

    .prologue
    .line 32
    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    iget v3, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->drawableId:I

    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 33
    .local v0, "drawable":Landroid/graphics/drawable/Drawable;
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2, v0}, Landroid/widget/ImageView;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 34
    instance-of v2, v0, Landroid/graphics/drawable/AnimationDrawable;

    if-eqz v2, :cond_22

    .line 35
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2}, Landroid/widget/ImageView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v1

    check-cast v1, Landroid/graphics/drawable/AnimationDrawable;

    .line 36
    .local v1, "spinner":Landroid/graphics/drawable/AnimationDrawable;
    invoke-virtual {v1}, Landroid/graphics/drawable/AnimationDrawable;->start()V

    .line 38
    .end local v1    # "spinner":Landroid/graphics/drawable/AnimationDrawable;
    :cond_22
    return-void
.end method

.method public setMessage(Ljava/lang/CharSequence;)V
    .registers 5
    .param p1, "message"    # Ljava/lang/CharSequence;

    .prologue
    .line 41
    if-eqz p1, :cond_2c

    invoke-interface {p1}, Ljava/lang/CharSequence;->length()I

    move-result v1

    if-lez v1, :cond_2c

    .line 42
    iget-object v1, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v2, "text_message"

    invoke-virtual {v1, v2}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v1

    invoke-virtual {p0, v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->findViewById(I)Landroid/view/View;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Landroid/view/View;->setVisibility(I)V

    .line 43
    iget-object v1, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v2, "text_message"

    invoke-virtual {v1, v2}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v1

    invoke-virtual {p0, v1}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 44
    .local v0, "txt":Landroid/widget/TextView;
    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 45
    invoke-virtual {v0}, Landroid/widget/TextView;->invalidate()V

    .line 47
    .end local v0    # "txt":Landroid/widget/TextView;
    :cond_2c
    return-void
.end method

.method public setSpinnerImage(I)V
    .registers 5
    .param p1, "drawableId"    # I

    .prologue
    .line 50
    if-gtz p1, :cond_3

    .line 67
    :cond_2
    :goto_2
    return-void

    .line 52
    :cond_3
    iput p1, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->drawableId:I

    .line 54
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2}, Landroid/widget/ImageView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v2

    instance-of v2, v2, Landroid/graphics/drawable/AnimationDrawable;

    if-eqz v2, :cond_1a

    .line 55
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2}, Landroid/widget/ImageView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v1

    check-cast v1, Landroid/graphics/drawable/AnimationDrawable;

    .line 56
    .local v1, "spinner":Landroid/graphics/drawable/AnimationDrawable;
    invoke-virtual {v1}, Landroid/graphics/drawable/AnimationDrawable;->stop()V

    .line 59
    .end local v1    # "spinner":Landroid/graphics/drawable/AnimationDrawable;
    :cond_1a
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2, p1}, Landroid/widget/ImageView;->setBackgroundResource(I)V

    .line 60
    iget-object v2, p0, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->imageView:Landroid/widget/ImageView;

    invoke-virtual {v2}, Landroid/widget/ImageView;->invalidate()V

    .line 62
    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {v2, p1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 63
    .local v0, "drawable":Landroid/graphics/drawable/Drawable;
    instance-of v2, v0, Landroid/graphics/drawable/AnimationDrawable;

    if-eqz v2, :cond_2

    .line 64
    check-cast v0, Landroid/graphics/drawable/AnimationDrawable;

    .end local v0    # "drawable":Landroid/graphics/drawable/Drawable;
    invoke-virtual {v0}, Landroid/graphics/drawable/AnimationDrawable;->start()V

    goto :goto_2
.end method
